package com.jy.controller;


import com.jy.common.enums.ResponseWrapper;
import com.jy.common.tool.JwtUtil;
import com.jy.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 话题 前端控制器
 * </p>
 *
 * @author fzg
 * @since 2024-11-12
 */
@RestController
@RequestMapping("/topic")
public class TopicController {

    private final TopicService topicService;

    public TopicController(TopicService topicService) {
        this.topicService = topicService;
    }

    @GetMapping("/getSearchAllInfo")
    public ResponseWrapper getSearchAllInfo(HttpServletRequest request) {
        String token = request.getHeader("token");
        Integer userAid = JwtUtil.getTokenId(token);
        return topicService.getSearchAllInfo(userAid);
    }

}
